package com.example.swagger2.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.Positive;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

@ApiModel("用户实体")
@Data //利用lombok生成 set/get/有属性的 getting 和 setting 方法，此外还提供了equals、canEqual、hashCode、toString 方法
public class User {
    @ApiModelProperty(value = "用户id", required = true, example = "1")
    @Positive(message = "id必须大于0")
    private int id;

    @ApiModelProperty(value = "用户名字", example = "steven")
    private String name;

    @ApiModelProperty(value = "用户地址", example = "宁波")
    private String address;

    @ApiModelProperty(value = "生日", example = "1987-08-08")
    private LocalDate birthDay;

    @ApiModelProperty(value = "是否已经结婚了", example = "true")
    private Boolean isMarried;

    @ApiModelProperty(value = "年龄", example = "10")
    @Min(value = 10, message = "最小的年龄不能小于10")
    private Integer age;

    @Email()
    @ApiModelProperty(value = "email地址", example = "whf@163.com")
    private String email;
}
